export const startApp = function () {
  let code = `
const automator = require('miniprogram-automator');

describe('searchResult', async () => {
  let miniProgram;
  let page;
  beforeAll(async () => {
    miniProgram = await automator.launch({
      projectPath: '../dist',
    });
    page = await miniProgram.reLaunch(
      '/packages/doctorwork/pages/searchResult/index',
    );
    await page.waitFor(500);
  }, 30000);
    
    `
  return code;
}

export const endApp = function () {
  let code =
    `
  afterAll(async () => {
    // await miniProgram.close();
  });
});

`
  return code;
}


export const createTest = function (tests = [], index) {
  let code =
    `
  it('testCase_${index + 1}', async () => {
  `
  // 拼接操作

  tests.code.forEach(test => {
    code += test
  })
  // 拼接结尾
  code +=
    `
  });

`
  return code;
}